package com.wigem.fa.controller;

import com.wigem.framework.common.pojo.PageResult;
import com.wigem.framework.common.util.web.response.Result;
import com.wigem.framework.common.util.web.response.ResultController;

import java.util.List;

import com.wigem.fa.entity.FaSupervisorEntity;
import com.wigem.fa.service.FaSupervisorService;
import com.wigem.fa.vo.FaSupervisorVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.swing.text.html.parser.Entity;

/**
 * 项目督导Controller
 *
 * @author HH
 * @date 2025-02-21
 */
@RestController
@RequestMapping("/fa/supervisor")
public class FaSupervisorController extends ResultController {


    @Resource
    private FaSupervisorService faSupervisorService;

    /**
     * 查询项目督导列表
     */
    @ResponseBody
    @GetMapping("/query")
    public Result getList(FaSupervisorVo faSupervisorVo) {

        return success(faSupervisorService.getList(faSupervisorVo));
    }
    /**
     * 查询项目督导汇总列表
     */
    @ResponseBody
    @GetMapping("/summary/query/page")
    public Result getSummaryPageList(FaSupervisorVo faSupervisorVo) {
        PageResult<FaSupervisorEntity> pageInfo = faSupervisorService.getSummaryPageList(faSupervisorVo);
        return success(pageInfo);
    }

    /**
     * 查询项目督导列表
     */
    @ResponseBody
    @GetMapping("/query/page")
    public Result getPageList(FaSupervisorVo faSupervisorVo) {
        PageResult<FaSupervisorEntity> pageInfo = faSupervisorService.getPageList(faSupervisorVo);
        return success(pageInfo);
    }

    /**
     * 查询项目督导实体
     */
    @ResponseBody
    @GetMapping("/query/{id}")
    public Result getEntity(@PathVariable("id") String id) {
        return success(faSupervisorService.getEntity(id));
    }


    /**
     * 查询项目督导实体
     */
    @ResponseBody
    @GetMapping("/query/dto")
    public Result queryDto(FaSupervisorVo faSupervisorVo) {
        return success(faSupervisorService.queryEntity(faSupervisorVo));
    }


    /**
     * 项目督导新增
     */
    @ResponseBody
    @PostMapping
    public Result add(@RequestBody FaSupervisorVo faSupervisorVo) {
        faSupervisorService.add(faSupervisorVo);
        return success("保存成功");
    }

    /**
     * 项目督导修改
     */
    @ResponseBody
    @PutMapping
    public Result update(@RequestBody FaSupervisorVo faSupervisorVo) {
        faSupervisorService.update(faSupervisorVo);
        return success("修改成功");
    }


    /**
     * 新增保存
     */
    @ResponseBody
    @PostMapping("/save")
    public Result save(@RequestBody FaSupervisorVo faSupervisorVo) {
        faSupervisorService.save(faSupervisorVo);
        return success("保存成功！");
    }


    /**
     * 删除
     */
    @ResponseBody
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable("id") String id) {
        faSupervisorService.delete(id);
        return success("删除成功！");
    }

    /**
     * 移除/逻辑删除
     */
    @ResponseBody
    @DeleteMapping("/remove/{id}")
    public Result remove(@PathVariable("id") String id) {
        faSupervisorService.remove(id);
        return success("删除成功！");
    }
}
